package com.rui.patterns.interpreter;

/**
 * @author : [锐神NO.3]
 * @version : [v1.0]
 * @className : Variable
 * @createTime : [2022/2/25 15:39]
 * @description : [描述该类的功能]
 */

public class Variable extends AbstractExpression {

    private String name;

    public Variable(String name) {
        this.name = name;
    }

    @Override
    public int interpret(Context context) {
        return context.getValue(this);
    }

    @Override
    public String toString() {
        return name;
    }
}
